//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_PaGenerator_H
#define Green_PaGenerator_H

#include "Defines.h"

namespace Green {

  class ConstraintSet;

  class PaGenerator {
  public:
    explicit PaGenerator(const ConstraintSet* baseConstr) : mpBaseConstraint(baseConstr), mIsInstruction(true) { } //!< Most used constructor.
    ~PaGenerator(); //!< Destructor.

    ASSIGNMENT_OPERATOR_ABSENT(PaGenerator);
    COPY_CONSTRUCTOR_DEFAULT(PaGenerator);
    uint64 GenerateAddress(uint64 align, uint64 size, bool isInstr, const ConstraintSet *rangeConstraintSet = nullptr); //!< Generate an address.
    uint64 GetAddressFromBottom(uint64 align, uint64 size, const ConstraintSet *rangeConstraintSet = nullptr); //!< Get an address from the bottom of the address constraint set.
    uint64 GetAddressFromTop(uint64 align, uint64 size, const ConstraintSet *rangeConstraintSet = nullptr); //!< Get an address from the top of the address constraint set.
  protected:
    PaGenerator() : mpBaseConstraint(nullptr), mIsInstruction(true) { } //!< Default constructor.

  protected:
    const ConstraintSet* mpBaseConstraint; //!< Pointer to base constraint.
    bool mIsInstruction; //!< Indicate if this is generating for instruction usage.
  };

}

#endif
